package com.hq.web.controller.workflow;

import java.util.List;
import java.util.Map;

import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hq.common.activiti.IWorkFlowService;

@Controller
public class WorkFlowCtrl {

	@Autowired
	IWorkFlowService workFlowApp;
	
	
	@RequestMapping("/activitiDefView")
	public String defView(){
		return "workflow/definitionList";
	}
	
	@RequestMapping("/workFlow/getDefinitionList")
	@ResponseBody
	public JSONObject getModels(){
		JSONObject jsonObject=new JSONObject();
		List<Map<String, Object>> list=workFlowApp.getProcessDefinition();
		jsonObject.put("rows", list);
		jsonObject.put("tatol", list.size());
		
		return jsonObject;
	}
	
	@RequestMapping("/workFlow/initProcessByKey")
	@ResponseBody
	public JSONObject initProcessByKey(String key){
		JSONObject jsonObject=new JSONObject();
		//Map<String, Object> list=workFlowApp.initProcessByKey(key);
		
		
		return jsonObject;
	}
	
}
